package com.dycong.common.leetcode.yi;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yilin
 * Date: 2019-08-28
 * Time: 15:46
 */
public class LruCacheV2 extends LinkedHashMap {
    private final int CACHE_SIZE = 0;

    public LruCacheV2(int CACHE_SIZE) {
        super((int) (Math.ceil(CACHE_SIZE / 0.75) + 1), 0.75F, true);
        CACHE_SIZE = CACHE_SIZE;

    }


    @Override
    protected boolean removeEldestEntry(Map.Entry eldest) {
        return size() > CACHE_SIZE;
    }
}
